package controller.account;

import pojo.account.Reader;
import service.AccountService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "ReaderQueryAllController", value = "/ReaderQueryAllController")
public class ReaderQueryAllController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Reader> readerList = new AccountService().getAllReader();

        request.setAttribute("readerList", readerList);
        request.getRequestDispatcher("/view/manager/queryReader/index.jsp").forward(request, response);
    }
}
